import React, { useContext } from 'react';
import { Space, Button, Select } from "antd";
import { MapCtx, type CesiumType } from "@/components/app/earth3dVis";

export const BaseLayerChange: React.FC = () => {
    const { cesiumUtil } = useContext(MapCtx).gisMapStore;
    const { viewer } = cesiumUtil;

    return <Space.Compact className="absolute" style={{right: 100, top: 50}}>
        <Button>底图切换</Button>
        <Select
            defaultValue={0}
            options={viewer.getBaseLayers().map((item, index) => ({
                label: item.name,
                value: index
            }))}
            onChange={(value) => viewer.changeBaseLayer(value)}
            style={{width: 150}}
        />
    </Space.Compact>
}
